package com.zhangxin.aiInterview.service;

import com.zhangxin.aiInterview.manager.knoewlege_base_api.dto.ExamQuestionWrapper;
import com.zhangxin.aiInterview.model.dto.exam.ExamGenerateRequest;
import com.zhangxin.aiInterview.model.entity.Exam;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhangxin.aiInterview.model.vo.response.DebugCodeResponse;
import com.zhangxin.aiInterview.model.vo.response.GetExamAnalyzeResultResponse;
import com.zhangxin.aiInterview.model.vo.response.PartQuestionCountResponse;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
* @author ZX
* @description 针对表【exam(笔试)】的数据库操作Service
* @createDate 2025-04-25 14:58:29
*/
public interface ExamService extends IService<Exam> {

    /**
     * 基于知识库生成笔试题
     *
     * @param techFieldId 领域id
     * @param positionId 职位id
     * @param companyId 公司名
     * @param isFull 是否为全流程面试
     * @param fullProcessInterviewId 全流程面试id
     * @param request
     */
    Long generateExam(Long techFieldId, Long positionId, Long companyId, HttpServletRequest request, Boolean isFull, Long fullProcessInterviewId);

    /**
     * 根据笔试id查询题目
     * @param examId
     * @param request
     * @return
     */
    ExamQuestionWrapper getQuestion(Long examId,HttpServletRequest request);

    /**
     * 调试代码
     * @param codeModel
     * @return
     */
    DebugCodeResponse debugCode(String codeModel);

    /**
     * 获取各部分题目数量
     * @param examId
     * @return
     */
    PartQuestionCountResponse getPartQuestionCount(Long examId);

    /**
     * 分析笔试结果
     * @param userId
     * @param examId
     * @param examDuration
     * @param answers
     * @param isFull
     * @param fullInterviewId
     * @return
     */
    boolean analyzeExamResult(Long userId, Long examId, Integer examDuration, String answers, Boolean isFull, Long fullInterviewId);

    /**
     * 公共接口：根据公司、岗位、面试角色生成笔试题
     * @param company 公司名称
     * @param position 岗位名称
     * @param interviewRole 面试角色
     * @return 生成的笔试题内容
     */
    String publicGenerateExam(String company, String position, String interviewRole);

    /**
     * 获取笔试分析结果(封装为java对象)
     * @param examId
     * @return
     */
    GetExamAnalyzeResultResponse getExamAnalyzeResult(Long examId);

    /**
     * 删除笔试记录
     * @param examId
     * @param request
     * @return
     */
    boolean deleteExam(Long examId, HttpServletRequest request);
}
